<template>
  <a-row>
    <a-col :span="4" :push="20"
      >col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
      col-push-6col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
      col-push-6col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
      col-push-6</a-col
    >
    <a-col :span="20" :pull="4"
      ><div class="ProblemPanel" style="padding: 0 30px 20px 0">
        <div class="problemDescription">
          <h1>题目详情</h1>
          <p>
            col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6 col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6 col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6 col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6
          </p>
        </div>
        <div class="inputDescription">
          <h1>输入描述</h1>
          <p>
            col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6 col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6 col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6 col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6
          </p>
        </div>
        <div class="outputDescription">
          <h1>输出描述</h1>
          <p>
            col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6 col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6 col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6 col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6
          </p>
        </div>
        <div style="height: max-content">
          <a-row class="content">
            <a-col :span="12" :push="12"
              ><div class="outputModel">
                <h1>输出样例</h1>
                <pre class="element1" id="element1">
col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
col-push-6col-18 col-push-6col-18 col-push-6col-18
col-push-6col-18 col-push-6col-18 col-push-6col-18
col-push-6col-18 col-push-6col-18 col-push-6 col-18
col-push-6col-18 col-push-6col-18 col-push-6col-18
col-push-6col-18 col-push-6col-18 col-push-6col-18
              </pre
                >
              </div></a-col
            >
            <a-col :span="12" :pull="12"
              ><div class="inputModel">
                <h1>输入样例</h1>
                <pre class="element2" id="element2">
col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
col-push-6col-18 col-push-6col-18 col-push-6col-18
col-push-6col-18 col-push-6col-18 col-push-6col-18
col-push-6col-18 col-push-6col-18 col-push-6 col-18
col-push-6col-18 col-push-6col-18 col-push-6col-18
col-push-6col-18 col-push-6col-18 col-push-6col-18
col-push-6col-18 col-push-6col-18 col-push-6col-18co


vl-push-6col-18 col-push-6col-18 col-push-6col-18
              </pre
                >
              </div></a-col
            >
          </a-row>
        </div>

        <div class="hitness">
          <h1>提示</h1>
          <p>
            col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6 col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6 col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6 col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6col-18 col-push-6col-18 col-push-6col-18 col-push-6col-18
            col-push-6
          </p>
        </div>
      </div>
      <div>
        <editorCode></editorCode>
      </div>
    </a-col>
  </a-row>
</template>
<script lang="tsx" setup>
import { onMounted } from "vue";
import gfm from "@bytemd/plugin-gfm";
import highlight from "@bytemd/plugin-highlight";
import { Editor, Viewer } from "@bytemd/vue-next";
import { ref } from "vue";
import editorCode from "./codeCompile.vue";
import { languages } from "monaco-editor";
import { useRouter } from "vue-router";
import { ProblemControllerService } from "../../../generated";
const router = useRouter();
/**
 * @name: 获取路由跳转问题ID
 * @return {problemId}
 */
const getRequestParams = router.currentRoute.value.query;

console.log();
/**
 * @name: 根据问题ID请求问题详情
 * @return {*}
 */

const requestByProblemId = async (problemId: any) => {
  const res = await ProblemControllerService.getProblemByProblemIdUsingPost(
    problemId
  );
  console.log(res.data);
};
requestByProblemId(getRequestParams.problemId);

interface problemStatus {
  problemId: number;
  displayId: string;
  title: string;
  difficulty: string;
  submissionNumber: number;
  rate: string;
  // address: string;
}
const problemMessage = ref<problemStatus>();
const plugins = [gfm(), highlight()]; // Add more plugins here15
const value = ref("");
const handlechange = (v: string) => {
  value.value = v;
};
const code = ref('console.log("Hello, Monaco Editor!");');
const language = ref("javascript");

// 处理编辑器内容变化的方法
const handleEditorChange = (value) => {
  console.log("Editor content changed in parent component:", value);
};
onMounted(() => {
  const element1 = document.getElementById("element1");
  const element2 = document.getElementById("element2");

  // 计算并设置最大高度
  const setMaxHeight = () => {
    const maxHeight =
      Math.max(element1.offsetHeight, element2.offsetHeight) + 10 + "px";
    element1.style.height = maxHeight;
    element2.style.height = maxHeight;
  };

  // 在文档加载完成后或其他适当的时机调用 setMaxHeight
  setMaxHeight();
});
</script>

<style scoped>
.ProblemPanel h1 {
  color: #1677ff;
}
.inputModel {
  padding: 5px 10px 5px 0px;
}
.outputModel {
  padding: 5px 0px 5px 0px;
}
.inputModel pre,
.outputModel pre {
  border: 1px solid rgb(172, 172, 172);
  /* background: transparent; */
  /* height: max-content; */
}
.content {
  display: flex;
}
</style>
